Skip to content

Fix MATLAB interface samples #1911

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft

Conversation

ssun30
Copy link
Contributor

@ssun30 ssun30 commented Jun 18, 2025

There are numerous changes to class structures to the MATLAB interface that necessitate modifications to our current collection of MATLAB samples.

Changes proposed in this pull request

  • Fix crashes/solver errors in MATLAB samples.
  • Compare the results to their equivalent Python samples to make sure the solutions are correct.

If applicable, fill in the issue number this pull request is fixing

Closes #1722

Checklist

  • The pull request includes a clear description of this code change
  • Commit messages have short titles and reference relevant issues
  • Build passes (scons build & scons test) and unit tests address code coverage
  • Style & formatting of contributed code follows contributing guidelines
  • The pull request is ready for review

Fixed a typo in Interface.concentrations
Copy link

codecov bot commented Jun 18, 2025

Codecov Report

Attention: Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.

Project coverage is 74.11%. Comparing base (305d5a1) to head (182f7b9).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
interfaces/matlab_experimental/Base/Interface.m 0.00% 1 Missing ⚠️
interfaces/matlab_experimental/Base/ThermoPhase.m 0.00% 1 Missing ⚠️
interfaces/matlab_experimental/OneDim/Sim1D.m 0.00% 1 Missing ⚠️
...faces/matlab_experimental/Reactor/ReactorSurface.m 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1911      +/-   ##
==========================================
- Coverage   74.11%   74.11%   -0.01%     
==========================================
  Files         445      445              
  Lines       55454    55453       -1     
  Branches     9121     9121              
==========================================
- Hits        41101    41098       -3     
- Misses      11262    11263       +1     
- Partials     3091     3092       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Changed refine criteria for Diff_flame
for axis for periodic_cstr.m sample
@ssun30 ssun30 force-pushed the matlab_fix_samples branch from 9a6a562 to f8ebb67 Compare June 20, 2025 13:38
Modified several samples to include this change
Copy link
Member

@ischoegl ischoegl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ssun30 ... thanks for addressing!

Out of curiosity: for the Python API, all examples are tested as part of a CI job, see run-examples in .github/workflows/main.yml.

The relevant code is:

   - name: Run the examples
        # See https://unix.stackexchange.com/a/392973 for an explanation of the -exec part.
        run: |
          ln -s libcantera_shared.so build/lib/libcantera_shared.so.3
          export LD_LIBRARY_PATH=build/lib
          find samples/python -type f -iname "*.py" \
          -exec sh -c 'for n; do echo "$n" | tee -a results.txt && python3 "$n" >> results.txt || exit 1; done' sh {} +

I believe it's possible to do something similar here as it's possible to run MATLAB scripts from the command line:

matlab -r "try, run('rankine.m'), catch, exit(1), end, exit(0)"

where I had set matlab to

alias matlab="/Applications/MATLAB_R2023b.app/bin/matlab -nojvm -nodesktop"

on macOS (fwiw, I just ran a quick test so the options may not be the greatest selection)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Broken flame examples in experimental MATLAB toolbox
2 participants